Don't request window sizes with zero width or height
authorAlexander Larsson <alexl@redhat.com>
Mon, 5 Oct 2009 20:07:06 +0000 (22:07 +0200)
committerAlexander Larsson <alexl@redhat.com>
Mon, 5 Oct 2009 20:07:06 +0000 (22:07 +0200)
Zero width/height is unsupported and will magically be turned into one.
For instance, gtk_widget_size_allocate() will eventually do this magic
on the value stored in widget->allocation.

However, if we don't do this magic conversion early, then the value
returned from gtk_window_compute_configure_request() will not be
comparable with whats stored in widget->allocation. (I.E. they will
differ if width or height are zero).

This is dangerous, as we do such a comparison in gtk_window_move_resize().
Currently a change from e.g. 10x1 (current allocation) to 10x0 (new size)
will be expected to produce a ConfigureNotify, when it actually won't,
thus never thawing the frozen toplevel.

Fixes bug #588059

gtk/gtkwindow.c

index c0815a93226af47d6b5afb9e42d4fcb61c59ec59..36c5a651936d009fad19262527d9b14abf2087f0 100644 (file)
@@ -5648,6 +5648,13 @@ gtk_window_compute_configure_request_size (GtkWindow *window,
       if (info->resize_height > 0)
         *height = info->resize_height;
     }
+
+  /* Don't ever request zero width or height, its not supported by
+     gdk. The size allocation code will round it to 1 anyway but if
+     we do it then the value returned from this function will is
+     not comparable to the size allocation read from the GtkWindow. */
+  *width = MAX (*width, 1);
+  *height = MAX (*height, 1);
 }
 
 static GtkWindowPosition